package gameStates.gui;

import main.listeners.listenerClasses.gui.LoginEvent;
import main.listeners.listenerClasses.gui.LoginListener;
import main.listeners.listenerClasses.gui.LogoutEvent;
import interfaces.login.LoginElement;
import gameStates.absGamesStates.gui.AbsLoginState;
import gameStates.passes.AbsPassManagerState;

public class LoginState extends AbsLoginState {
	
	public LoginState(AbsPassManagerState passManagerState) {
		super(passManagerState, true);
		
		interfaceElement = new LoginElement(this);
		
		addListenerToClearer(new LoginListener() {
			@Override
			public void userLoggedOut(LogoutEvent event) {
				setActive(true);
			}
			
			@Override
			public void userLoggedIn(LoginEvent event) {
				setActive(false);
			}
		});
		
		putAtSecondEnd();
	}
	
	@Override
	public void restore() {
		super.restore();
		interfaceElement = new LoginElement(this);
	}
}